<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //解构必须变量名和属性名一致！！
    const obj = {
      a: 1,
      b: 2
    }
    const { a, b } = obj
    console.log(a, b)
    const { uname, age } = { uname: 'zp', age: 18 }
    console.log(uname, age)

    //数组对象解构
    const pig = [{
      name: '佩奇',
      agee: 6
    }]
    const [{ name, agee }] = pig
    console.log(name)
    console.log(agee)
  </script>
</body>

</html>